<#include "/common/head.html"/>
<div class="easyui-panel addPage" data-options="fit:true,border:false,novalidate:true">
	<form class="easyui-form" id="ff" method="post" data-options="novalidate:true">
		<table class="table1">
			<tr>
				<th><span id="name_label">模板名称：</span></th>
				<td>
					<div class="wrap_input">
						<input class="easyui-textbox" type="text" name="template_name" id="template_name" value=""
							data-options="fit: true,required:true"></input>
					</div>
				</td>
			</tr>
			<tr>
				<th><span id="target_type_label">所属分类：</span></th>
				<td>
					<div class="wrap_input">
						<input class="easyui-combobox" id="classify_value" name="classify_value" value=""
							data-options="valueField: 'id',textField: 'text',fit: true,
							data: [
	            				{id:'', text:''}<#list classify.keySet() as key>,{id:'${key}', text:'${classify.get(key)}'}</#list>
	            			],required:true" />
					</div>
				</td>
			</tr>
		</table>
	</form>
</div>
<script type="text/javascript">
	top.window.subPage.save = save;
	function save() {
		if ($("#ff").form('enableValidation').form('validate')) {
			$.post("add", getParam(), function(data) {
				top.window.closeWindow();
				top.window.subPage.loadCurrDatagrid();
			});
		}
	}

	function getParam() {
		var param = {
			"model.template_name" : getInputValue("template_name"),
			"model.classify_value" : getInputValue("classify_value")
		}
		for (key in param) {
			if (!param[key]) {
				delete param[key];
			}
		}
		return param;
	}
</script>
<#include "/common/foot.html"/>
